package com.llt.userservice.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/get")
    public String get() {
        return "sssssssssssssssssss";
    }

    @GetMapping("/login")
    public String login() {
        String token = "aaaaaa.bbbbb.ccccc";

        redisTemplate.opsForValue().set("token", token, 30, TimeUnit.MINUTES);

        return token;
    }
}
